#pragma once

#include <QMap>
#include <QVector>
#include <QStringList>
#include <QVariant>
#include <memory>

#include "ISimpleChannel.h"
#include "IChannelFactory.h"


class ChannelFactory : public IChannelFactory<ISimpleChannelPtr>
{
public:
    static ChannelFactory& Instance();

public:
    virtual Channel CreateChannel(const QString& type, const StringMap& settings); 
    QStringList GetChannelTypes();
    QVariant GetChannelOption(const QString& key, const QVariant& def);

private:
    typedef ISimpleChannelPtr (ChannelFactory::*MakeFunc)();
    QMap<QString, MakeFunc> _manufacturer;
    StringMap _settings;

private:
	ChannelFactory();
	ChannelFactory(ChannelFactory& factory);

private:
    ISimpleChannelPtr CreateSerial();
    ISimpleChannelPtr CreateClientSocket();
    ISimpleChannelPtr CreateServerSocket();
    ISimpleChannelPtr CreateDataDirectory();
};
